<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/4/8
 * Time: 13:46
 */
namespace app\blog\controller;
use cmf\controller\AdminBaseController;
use think\Db;

class OperatorController extends AdminBaseController
{    
    public function index()
    {  
        $param = $this->request->param();
        $where=array();
        if(isset($param['start_time'])&&!empty($param['start_time'])){
            $where['ctime'][]=array('egt',strtotime($param['start_time']));
        }
        if(isset($param['end_time'])&&!empty($param['end_time'])){
            $where['ctime'][]=array('elt',strtotime($param['end_time']));
        }
        $operator=isset($param['operator'])?$param['operator']:'';
        $uid=cmf_get_current_admin_id();
        $userList=get_user_list($uid);
        $uid_list_str=toStr($userList,'userid');
        $uid_list_str.=','.$uid;
        $operator_list=Db::name('User')->where(array('store_id'=>array('neq','0'),'status'=>1,'id'=>array('in',$uid_list_str)))->select()->toarray();
        //echo Db::name('User')->getlastsql();
        $operatorid_list=toStr($operator_list,'id');
        $list=array();
        $page='';
        if(!empty($operatorid_list)){
            $where['operatorid']=array('in',$operatorid_list);
            $list=Db::name('OperatorStatis')->where($where)->order("id DESC")->paginate(10);
            $list->appends($where);
            $page = $list->render(); 
        }
       // 获取分页显示
        $this->assign("page", $page);
        $this->assign("list", $list);
        return $this->fetch();        
    }
}